from django_filters import rest_framework as filters

from apps.system.models import User


class UserFilter(filters.FilterSet):
    # like模糊查询方式
    username = filters.CharFilter(lookup_expr='contains')
    mobile = filters.CharFilter(lookup_expr='contains')
    email = filters.CharFilter(lookup_expr='contains')

    is_active = filters.BooleanFilter(field_name='is_active')

    class Meta:
        model = User
        fields = ['username', 'mobile', 'email', 'is_active']
